home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / ada_gwu / units.c < prev    next >
C/C++ Source or Header  |  1996-01-30  |  734b  |  32 lines

  1. /*
  2.  * Copyright (C) 1985-1992  New York University
  3.  * 
  4.  * This file is part of the Ada/Ed-C system.  See the Ada/Ed README file for
  5.  * warranty (none) and distribution info and also the GNU General Public
  6.  * License for more details.
  7.  
  8.  */
  9.  
  10. #include "hdr.h"
  11. #include "vars.h"
  12. #include "unitsp.h"
  13.  
  14. int unitNumberFromName(char *name)            /*;unitNumberFromName*/
  15. {
  16.     int i;
  17.     if (!name) return 0;
  18.     for (i = 1; i <= unit_numbers; i++)
  19.         if (pUnits[i]->name && !strcmp(name, pUnits[i]->name))
  20.             return i;
  21.     return 0;
  22. }
  23. int unitNumberFromLibUnit(char *name)            /*;unitNumberFromLibUnit*/
  24. {
  25.     int i;
  26.     if (!name) return 0;
  27.     for (i = 1; i <= unit_numbers; i++)
  28.         if (pUnits[i]->libUnit && !strcmp(name, pUnits[i]->libUnit))
  29.             return i;
  30.     return 0;
  31. }
  32.